<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        input {
            border: none;
            border-bottom: 1px solid black;
            outline: none;
        }

        input:nth-of-type(2) {
            width: 110px;
            margin: 20px 10px 0 0;
        }
    </style>
</head>

<body>
    手机号码: <input type="text" name="" id=""><br>
    <input type="text" name="" id=""><button>发送验证码</button>
    <script>
        var btn = document.querySelector('button')
        btn.addEventListener('click', function () {
              let  tim = 9
             btn.disabled = true
           let va= setInterval(function () {
               if(tim==0){
                clearInterval(va);
                btn.disabled=false
                btn.innerHTML='发送验证码'
               }else{             
                btn.innerHTML = '还剩' + tim + '秒'
                tim--;
               }
            }, 1000)
        })
      
    </script>
</body>

</html>